package me.zhengjie.modules.lock.rest;

import com.zelk.lock.api.vo.LockDeviceLogPageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import me.zhengjie.annotation.AnonymousAccess;
import me.zhengjie.modules.lock.service.LockDeviceLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "日志：日志列表")
@RequestMapping("/api/v1/lock/log")
public class LockDeviceLogController {
    @Autowired
    private LockDeviceLogService logService;

    @AnonymousAccess
    @ApiOperation("查询日志列表")
    @GetMapping(value = "/list")
    //@PreAuthorize("@el.check('log:list')")
    public ResponseEntity<Object> getLogs(LockDeviceLogPageVO queryLockLogVO, Pageable pageable) {
        return new ResponseEntity<>(logService.getLogs(queryLockLogVO, pageable), HttpStatus.OK);
    }
}
